package com.zzy.controller;

import com.zzy.domain.dto.PageLocalDto;
import com.zzy.domain.Result;
import com.zzy.domain.po.WarehouseLocal;
import com.zzy.domain.vo.PageResult;
import com.zzy.service.WarehouseLocalService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/warehouseLocal")
public class WarehouseLocalContraller {
    private final WarehouseLocalService warehouseLocalService;

    @GetMapping("/local")
    public PageResult<WarehouseLocal> getWareLocalPage(PageLocalDto dto) {
        return warehouseLocalService.getPage(dto);
    }

    @DeleteMapping("/delete/{id}")
    public Result getDelete(@PathVariable Integer id) {
        warehouseLocalService.removeById(id);
        return Result.success();
    }
    @PostMapping("/add")
    public Result addWarehouseLocal(@RequestBody WarehouseLocal warehouseLocal) {
        warehouseLocalService.add(warehouseLocal);
        return Result.success();
    }

    @PutMapping("/update")
    public Result updateWarehouseLocal(@RequestBody WarehouseLocal warehouseLocal) {
        warehouseLocalService.updateWarehouseLocal(warehouseLocal);
        return Result.success();
    }
    }

